package com.example.config.rabbitConfig;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {
    //声明队列
    @Bean
    public Queue logQueue(){
        return new Queue("sys_log_queue");
    }
    //声明交换机
    @Bean
    public DirectExchange logExchange(){
        return new DirectExchange("mobile_code_queue",true,false);
    }
    //绑定交换机和队列
    @Bean
    public Binding logBinding(){
        return BindingBuilder.bind(logQueue()).to(logExchange()).with("aopLog");
    }
}
